//Declare Variables
int inp=0;
int doorState = 0;

//Setup mode
void setup(){
  pinMode(9, OUTPUT); //Pin 9 as an output for locking or not
  pinMode(10, OUTPUT); //Pin 10 as an output for blinking
  pinMode(11, INPUT); //Pin 11 as an input state for the door
  Serial.begin(9600);
}

//Process
void loop(){
  if(Serial.available()>0){
    inp = Serial.read(); /
    Serial.print("Input Letter: ");
    Serial.println(char(inp));
    doorState = digitalRead(11); //Read letter 'L' or 'U'
    switch (inp) { //Use case
      
      case 'L':
        if(doorState==HIGH){
          digitalWrite(9, HIGH);
          digitalWrite(10, HIGH); 
          delay(1000); //Blink 1 second
          digitalWrite(10, LOW);
        }
        if(doorState==LOW){ //Do nothing
          digitalWrite(9, LOW);
          digitalWrite(10,LOW);
        }
        break;
        
      case 'U':
        if(doorState==HIGH){
          digitalWrite(9, LOW);
          digitalWrite(10, HIGH);
          delay(1000); //Blink 1 second
          digitalWrite(10, LOW);
          delay(1000);
          digitalWrite(10, HIGH);
          delay(1000); //Blink another 1 second
          digitalWrite(10, LOW);
        }
        if(doorState==LOW){ //Do nothing
          digitalWrite(9, LOW);
          digitalWrite(10,LOW);
        }
        break;
    }
  }
}
